package com.marvels.product.productmanage.Feign.impl;

import java.util.List;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import com.marvels.common.dto.MarvelsResultDTO;
import com.marvels.common.exception.MarvelsErrorCode;
import com.marvels.common.utils.MarvelsLogUtil;
import com.marvels.financial.loan.service.impl.FundServiceImpl;
import com.marvels.product.productmanage.Feign.Financial;
import com.marvels.product.productmanage.dto.FundDTO;

import cn.hutool.core.bean.BeanUtil;

@Service
public class FinancialImpl implements Financial{

	@Autowired
	private FundServiceImpl fundService;
	
	@Override
	public MarvelsResultDTO listCMPT(FundDTO ptDto) {
		try {
			com.marvels.financial.funds.dto.FundDTO param = new com.marvels.financial.funds.dto.FundDTO();
			BeanUtil.copyProperties(ptDto, param);
			List<com.marvels.financial.funds.dto.FundDTO> pts = fundService.findFundDTO(param);
			MarvelsLogUtil.getInstance().info("Financial.listCMPT direct call success!");
			return MarvelsResultDTO.getResult(MarvelsErrorCode.SUCCESS.getValue(), MarvelsErrorCode.SUCCESS.getDesc(),pts);
		} catch (Exception e) {
			MarvelsLogUtil.getInstance().error("Financial.listCMPT error", e);
			return MarvelsResultDTO.getResult(MarvelsErrorCode.ERROR.getValue(), MarvelsErrorCode.ERROR.getDesc(),"系统异常");
		}
	}

}
